class CommentController < ProtectedController

  def new
    @comment = Comment.new
  end

  def create
#    @comment = @weibo.comments.build(params[:comment])
    @comment = Comment.new(params[:comment])
    @comment.save!
    flash[:notice] = "评论添加成功!"
    redirect_to "/weibo"
  rescue ActiveRecord::RecordInvalid
    render :action => "new"
  end

  def destroy
    @comment = Comment.find(params[:id])
    @comment.destroy
    redirect_to "/weibo"
  end

end